# Maintainer: George Rawlinson <grawlinson@archlinux.org>

pkgname=gmni
pkgver=1.0
pkgrel=1
pkgdesc='A Gemini client'
arch=('loong64' 'x86_64')
url='https://git.sr.ht/~sircmpwn/gmni'
license=('GPL3')
depends=('bearssl')
makedepends=('git' 'scdoc')
_commit='41e5188b6e217a4bfd6d1802b73f49cc49472c17'
source=("$pkgname::git+$url#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed 's/^v//'
}

build() {
  cd "$pkgname"

  mkdir build && cd build

  # prevent mangling of static library
  CFLAGS+=" -ffat-lto-objects"

  ../configure --prefix=/usr

  make PREFIX=/usr
}

package() {
  cd "$pkgname/build"

  make PREFIX=/usr DESTDIR="$pkgdir" install

  # documentation
  install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" ../README.md
}
